SQL 2 DAX

Una comparación entre el lenguaje SQL (Structured Query Language) y el lenguaje DAX (Data Analysis Expressions)

SQL DAX
SQL DQL (DATA QUERY LANGUAGE) SELECT tiene equivalente DAX
SELECT column FROM table table[column]
SELECT DISTINCT column FROM table VALUES(table[column])
SELECT column, COUNT(*) FROM table GROUP BY column SUMMARIZE(table, table[column], "count", COUNT(table[column]))
SELECT column, AVG(value) FROM table GROUP BY column SUMMARIZE(table, table[column], "average", AVERAGE(table[value]))
SELECT TOP 10 column FROM table ORDER BY value DESC TOPN(10, table, table[value], DESC)
SELECT column FROM table WHERE column = value CALCULATETABLE(table, table[column] = value)
SELECT column FROM table WHERE column IN (value1, value2) CALCULATETABLE(table, table[column] IN {value1, value2})
SELECT column FROM table WHERE column LIKE '%value%' CALCULATETABLE(table, SEARCH("value", table[column], 1, LEN(table[column]), BLANK()) <> BLANK())
SELECT column FROM table WHERE column BETWEEN value1 AND value2 CALCULATETABLE(table, table[column] >= value1 && table[column] <= value2)
SELECT COUNT(*) FROM table WHERE column IS NULL CALCULATE(COUNT(table[column]), ISBLANK(table[column]))
SELECT COUNT(*) FROM table WHERE column IS NOT NULL CALCULATE(COUNT(table[column]), NOT(ISBLANK(table[column])))
SELECT MIN(column) FROM table MIN(table[column])
SELECT MAX(column) FROM table MAX(table[column])
SELECT SUM(column) FROM table SUM(table[column])
SELECT AVG(column) FROM table AVERAGE(table[column])
SELECT COUNT(column) FROM table COUNT(table[column])
SELECT COUNT(DISTINCT column) FROM table DISTINCTCOUNT(table[column])
SELECT column, COUNT(*) FROM table GROUP BY column HAVING COUNT(*) > value CALCULATETABLE(SUMMARIZE(table, table[column], "count", COUNT(table[column])), [count] > value)
SELECT column1, column2 FROM table ORDER BY column1 ASC, column2 DESC EVALUATE table ORDER BY table[column1], table[column2] DESC
SELECT column FROM table1 INNER JOIN table2 ON table1.column = table2.column CALCULATETABLE(table1, RELATED(table2[column]))
SELECT column FROM table1 LEFT JOIN table2 ON table1.column = table2.column CALCULATETABLE(table1, NOT(ISBLANK(RELATED(table2[column]))))
SELECT column FROM table1 RIGHT JOIN table2 ON table1.column = table2.column CALCULATETABLE(table2, NOT(ISBLANK(RELATED(table1[column]))))
SELECT column FROM table1 FULL OUTER JOIN table2 ON table1.column = table2.column CALCULATETABLE(table1, NOT(ISBLANK(RELATED(table2[column]))) || CALCULATETABLE(table2, NOT(ISBLANK(RELATED(table1[column])))))
SELECT column FROM table1 UNION SELECT column FROM table2 UNION(VALUES(table1[column]), VALUES(table2[column]))
SELECT column FROM table1 UNION ALL SELECT column FROM table2 CONCATENATE(VALUES(table1[column]), VALUES(table2[column]))
SELECT column FROM table1 INTERSECT SELECT column FROM table2 INTERSECT(VALUES(table1[column]), VALUES(table2[column]))
SELECT column FROM table1 EXCEPT SELECT column FROM table2 EXCEPT(VALUES(table1[column]), VALUES(table2[column]))
SELECT column FROM table1 MINUS SELECT column FROM table2 EXCEPT(VALUES(table1[column]), VALUES(table2[column]))
SELECT column FROM table LIMIT value TOPN(value, table, table[column])
SELECT column FROM table OFFSET value ROWS TOPN(COUNTROWS(table) - value, table, table[column], DESC)
SELECT column FROM table OFFSET value ROWS FETCH NEXT value ROWS ONLY TOPN(value, TOPN(COUNTROWS(table) - value, table, table[column], DESC), table[column])
SELECT column FROM table FETCH FIRST value ROWS ONLY TOPN(value, table, table[column])
SELECT column FROM table FETCH FIRST value PERCENT ROWS ONLY TOPN(ROUND(value / 100 * COUNTROWS(table), 0), table, table[column])
SELECT column FROM table FETCH FIRST value ROWS WITH TIES TOPN(value, table, table[column], DESC, ALL)
SELECT column FROM table FETCH FIRST value PERCENT ROWS WITH TIES TOPN(ROUND(value / 100 * COUNTROWS(table), 0), table, table[column], DESC, ALL)
SELECT column FROM table WHERE column = value EVALUATE FILTER(table, table[column] = value)
SELECT column FROM table WHERE column > value EVALUATE FILTER(table, table[column] > value)
SELECT column FROM table WHERE column < value EVALUATE FILTER(table, table[column] < value)
SELECT column FROM table WHERE column >= value EVALUATE FILTER(table, table[column] >= value)
SELECT column FROM table WHERE column <= value EVALUATE FILTER(table, table[column] <= value)
SELECT COUNT(*) AS TOTAL FROM table TOTAL:=COUNTROWS(table)
SELECT SUM(column) AS SUMA_column FROM table SUMA_column:=SUMX(table, table[column])
SELECT AVG(column) AS PROMEDIO_column FROM table PROMEDIO_column:=AVERAGEX(table, table[column])
SELECT MIN(column) AS MINIMO_column FROM table MINIMO_column:=MINX(table, table[column])
SELECT MAX(column) AS MAXIMO_column FROM table MAXIMO_column:=MAXX(table, table[column])
SQL DDL (DATA DEFINITION LANGUAGE) CREATE, ALTER Y DROP no tienen equivalente DAX
CREATE TABLE table (column1 type1, column2 type2, ...) No hay un equivalente directo en DAX
ALTER TABLE table ADD column type No hay un equivalente directo en DAX
DROP TABLE table No hay un equivalente directo en DAX
SQL DML (DATA MANIPULATION LANGUAGE) INSERT, UPDATE Y DELETE no tienen equivalente DAX
INSERT INTO table (column1, column2, ...) VALUES (value1, value2, ...) No hay un equivalente directo en DAX
UPDATE table SET column = value WHERE condition No hay un equivalente directo en DAX
DELETE FROM table WHERE condition No hay un equivalente directo en DAX
SQL DCL (DATA CONTROL LANGUAGE) GRANT Y REVOKE no tienen equivalente DAX
GRANT privilege ON object TO user No hay un equivalente directo en DAX
REVOKE privilege ON object FROM user No hay un equivalente directo en DAX
SQL TCL (TRANSACTION CONTROL LANGUAGE) COMMIT, ROLLBACK Y SAVEPOINT no tienen equivalente DAX
COMMIT No hay un equivalente directo en DAX
ROLLBACK No hay un equivalente directo en DAX
SAVEPOINT savepoint_name No hay un equivalente directo en DAX